package com.ywang.puremvc.impl;

import com.ywang.puremvc.framework.ICommand;
import com.ywang.puremvc.framework.INotification;

/**
 * @author ywang
 */
public abstract class SimpleCommand implements ICommand {

    INotification notification;
    boolean isCanceled;
    int type = TYPE_EVENT;
    
    public void appendNotification(INotification notification) {
        this.notification = notification;
    }
    
    @Override
    public int execute() {
        return isCanceled ? CANCELED : OK;
    }

    @Override
    public void cancel() {
        isCanceled = true;
    }

    @Override
    public void setType(int type) {
        this.type = type;
    }

    @Override
    public int getType() {
        return type;
    }
}
